<?php
  //Last modified - 24-Nov-2007, added to repository on 15-Oct-2008
  //For current colourpark square - r=0&g=54&b=178
	header("Content-type: image/png");
	
	$y = $x= 64;
	$detach = 92; /* percetage */
	
	$image = imagecreate($x, $y); //need transparent background, hence do not use imagecreatetruecolor()
	$background = imagecolorallocatealpha($image, 255, 255, 255, 127);
	$square = imagecolorallocatealpha($image, $_GET['r'], $_GET['g'], $_GET['b'], 0);
	
	
	//background
	imagefilledrectangle($image, 0, 0, $x-1, $y-1, $background); //set background
	
	//squares
	imagefilledrectangle($image, 0, 0, $x*$detach/100/2, $y*$detach/100/2, $square); //upper left square
	//technically I don't know why i need to add that 1 in upper right square, but it fixes the 1 pixel gap though.
	imagecopy($image, $image, $x*$detach/100/2, 0, 0, 0, $x*$detach/100/2, ($y*$detach/100/2)+1); //upper right square,
	imagecopy($image, $image, 0, $y*$detach/100/2, 0, 0, $x*$detach/100/2, ($y*$detach/100/2)+1); //lower left square
	imagecopy($image, $image, $x*(1-$detach/100/2), $y*(1-$detach/100/2), 0, 0, $x*$detach/100/2, ($y*$detach/100/2)+1); //lower right square
	
	imagepng($image);
	imagedestroy($image);
?>